﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace WebSiteBuilder.Account
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
        }

        protected void LoginButton_Click(object sender, EventArgs e)
        {
            var user = Membership.GetUser(LoginUser.UserName);
            MembershipCreateStatus status;

            if (user == null)
            {
                user = Membership.CreateUser(LoginUser.UserName, "3rdp@rty", "xyz@tdsc.com", "no question", "no answer", true, out status);
            }

            FormsAuthentication.RedirectFromLoginPage(LoginUser.UserName, false); 
        }
    }
}
